package com.example.javafx.切换按钮;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.ToggleButton;
import javafx.scene.control.ToggleGroup;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;

public class Main extends Application {
    @Override
    public void start(Stage primaryStage) throws Exception {
        HBox hBox = new HBox();

        Scene scene = new Scene(hBox,300,250);
        ToggleGroup group = new ToggleGroup();

        ToggleButton tb1 = new ToggleButton("Hign");
        tb1.setToggleGroup(group);
        tb1.setSelected(true);
        ToggleButton tb2 = new ToggleButton("Medium");
        tb2.setToggleGroup(group);
        ToggleButton tb3 = new ToggleButton("Low");
        tb3.setToggleGroup(group);
        scene.getStylesheets().add("myStyle.css");
        tb1.getStyleClass().add("toggle-button1");
        tb2.getStyleClass().add("toggle-button2");
        tb3.getStyleClass().add("toggle-button3");
        hBox.getChildren().addAll(tb1,tb2,tb3);
        primaryStage.setScene(scene);
        primaryStage.show();

    }

    public static void main(String[] args) {
        launch(args);
    }
}
